﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.Linq;

namespace SongTitles
{
    class Program
    {
        static void Main(string[] args)
        {

            //using (XmlTextReader reader = new XmlTextReader("../../catalog.xml"))
            //{
            //    while (reader.Read())
            //    {
            //        if ((reader.NodeType == XmlNodeType.Element) &&
            //            (reader.Name == "title"))
            //        {
            //            Console.WriteLine(reader.ReadElementString());
            //        }
            //    }
            //}


            XDocument xmlDoc = XDocument.Load("../../catalog.xml");
            var titles =
                from title in xmlDoc.Descendants("song")
                select new
                {
                    Title = title.Element("title").Value,

                };
            foreach (var tit in titles)
            {
                Console.WriteLine(" - {0} ", tit.Title);
            }
        }
    }
}
